import React, { PropsWithChildren } from "react";
import { AmountItem3Amount, AmountItem3Title, AmountItem3Wrap } from "./styles";
import { parseMoney } from "../utils/parseMoney";

export interface AmountItem3Props extends PropsWithChildren {
  title?: string;
  /**
   *  金额
   */
  amount?: number;
  type?: number;
}

const AmountItem = ({ title, amount = 0, type = 1 }: AmountItem3Props) => {
  return (
    <AmountItem3Wrap className={"type" + type}>
      <AmountItem3Title>{title}</AmountItem3Title>
      <AmountItem3Amount>
        {parseMoney(amount, 2, true, false)}
      </AmountItem3Amount>
    </AmountItem3Wrap>
  );
};

export default AmountItem;
